﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;

namespace TrailMapManager.Common
{
    public class BaseViewLogic : INotifyPropertyChanged
    {
        private bool _isBusy;
        public virtual bool IsBusy
        {
            get { return _isBusy; }
            set { _isBusy = value; NotifyPropertyChanged("IsBusy"); }
        }

        protected DispatcherOperation InvokeOnMainThread(Action action)
        {
            return Application.Current.Dispatcher.BeginInvoke(action, null);
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
